<script setup lang="ts">
// const props = defineProps<{
//   modelValue?: boolean,
// }>()
import { computed, ref } from 'vue';

import { auto1688stor } from '#/store';

const auto1688storTres = auto1688stor();

const nowData = computed(() => auto1688storTres.auto1688.nowSelectDyShop);

const dataInxiayou = auto1688storTres.auto1688.bindShopList?.filter(
  (item) => item.pType === 2,
);
const selectDyShop = ref(nowData?.value?.shopId || null);
function confirmFun() {
  auto1688storTres.auto1688.setSelectNowShop(selectDyShop.value);
}
</script>

<template>
  <a-space v-if="nowData" size="5">
    <div class="mr-4">当前选择的店铺:{{ nowData?.shopName }}</div>
    <a-popconfirm @confirm="confirmFun">
      <template #title>
        <div v-for="item in dataInxiayou" :key="item.shopId">
          <a-radio-group v-model:value="selectDyShop">
            <a-radio :value="item.shopId">{{ item.shopName }}</a-radio>
          </a-radio-group>
        </div>
      </template>
      <template #icon></template>
      <a-button type="link">切换店铺</a-button>
    </a-popconfirm>
  </a-space>
  <div v-else>没有绑定抖店</div>
</template>
